import JSEncrypt from 'jsencrypt/bin/jsencrypt.min'
export default {
	data() {
		return {

		}
	},
	methods: {
		// RAS 签名
		async signParams(loginName) {
			let params = {
				date:this.$u.timeFormat(new Date(), 'yyyymmddhhMMss'),
				loginName
			}
			let keyList = Object.keys(params).sort().map(item => {
				return params[item]
			})
			let canSignData = keyList.join('')
			console.log({
				canSignData
			});
			// 签名
			params.sign = this.getRSAencry(canSignData);
			// params.scanAppid = 'abc123456'
			return params
		},
		getRSAencry(str_value) {
			if (typeof a != 'string') {
				str_value = str_value

			}
			let publicKey = this.$config.pubKey
			let jse = new JSEncrypt();
			jse.setPublicKey(publicKey);
			return jse.encrypt(str_value)

		},
	},
}